package com.onlinelearn.paymentservice.repository;

import com.onlinelearn.paymentservice.model.PaymentOrder;
import com.onlinelearn.paymentservice.model.PaymentOrderStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

@Repository
public interface PaymentOrderRepository extends JpaRepository<PaymentOrder, Long> {
    List<PaymentOrder> findByStudentId(Long studentId);
    
    List<PaymentOrder> findByStatusAndExpirationTimeBefore(
        PaymentOrderStatus status, 
        LocalDateTime expirationTime
    );

    List<PaymentOrder> findByStatusAndPaymentTimeBetween(
        PaymentOrderStatus status,
        LocalDateTime startTime,
        LocalDateTime endTime
    );
} 